<?php
	require_once( '../../_config/base.inc.php' );
	
	use \dayscript\ErrorManager;
	use \dayscript\xml\rpc\Client;
	use \dayscript\util\Debug;
	use \dayscript\util\Benchmark;
	
	\dayscript\Application::getInstance( BASE_DIR . '_config/tests.inc.php' );
	ErrorManager::setUproarMode( true ); // Not for production
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<title>XMLRPC Test</title>
	<link rel="stylesheet" type="text/css" media="all" href="../../_resources/styles.css" />
</head>
<body>
<?php

echo "<br /><b>Usando servidor:</b> http://scripts.incutio.com/xmlrpc/simpleserver.php";

$client = new Client( 'http://scripts.incutio.com/xmlrpc/simpleserver.php' );
echo "<br /><br />Funci&oacute;n getTime:";
if( !$client->call( 'test.getTime' ) )
	echo "<br />&nbsp;&nbsp;&nbsp;Error:" . $client->getErrorCode( ) . ':' . $client->getErrorMessage( );
else
	echo "<br />&nbsp;&nbsp;&nbsp;Respuesta:" . Debug::dump( $client->getResponse( ), true );

echo "<br /><br />Funci&oacute;n add: ( 4, 5 )";
if( !$client->call( 'test.add', array( 4, 5 ) ) )
	echo "<br />&nbsp;&nbsp;&nbsp;Error:" . $client->getErrorCode( ) . ':' . $client->getErrorMessage( );
else
	echo "<br />&nbsp;&nbsp;&nbsp;Respuesta:" . Debug::dump( $client->getResponse( ), true );
	
echo "<br /><br />Funci&oacute;n addArray: ( 3, 5, 7 )";
if( !$client->call( 'test.addArray', array( array( 3, 5, 7 ) ) ) )
	echo "<br />&nbsp;&nbsp;&nbsp;Error:" . $client->getErrorCode( ) . ':' . $client->getErrorMessage( );
else
	echo "<br />&nbsp;&nbsp;&nbsp;Respuesta:" . Debug::dump( $client->getResponse( ), true );
	
?>
<br />
<br />
<pre>
<b>Benchmark:</b><?php echo Benchmark::getInstance( )?>
</pre>
</body>
</html>